package com.syr;

import java.io.IOException;
/*
方法重写的规则一：
子类重写的方法抛出的异常类型不大于父类被重写的方法抛出的异常类型

 */
public class OverrideTest {

    public void display(SuperClass s) {
        try {
            s.method();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        OverrideTest overrideTest = new OverrideTest();
        overrideTest.display(new SubClass());

    }

}

class SuperClass {

    public void method() throws IOException {

    }
}

class SubClass extends SuperClass {

    public void method() {

    }
}
